using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlantData : EntityData
{
    /// <summary>
    /// 植物类型
    /// </summary>
    public PlantType Type;

    /// <summary>
    /// 种植成本
    /// </summary>
    public int Cost;

    [Header("死亡设置")]
    [Tooltip("是否有死亡动画。false表示没有死亡动画，死亡时直接销毁（如火爆辣椒等）")]
    public bool HasDeathAnimation = true; // 默认为true，有死亡动画

    /// <summary>
    /// 在Inspector中点击Reset时调用
    /// </summary>
    private void Reset()
    {
        // 根据不同植物类型自动设置默认类型
        if (this is SnowPeaData)
            Type = PlantType.SnowPea;
        else if (this is ShooterData)
            Type = PlantType.PeaShooter;
        else if (this is SunflowerData)
            Type = PlantType.SunFlower;
        else if (this is TallNutData)
            Type = PlantType.TallNut;
        else if (this is GatlingData)
            Type = PlantType.Gatling;
        else if (this is JalapenoData)
            Type = PlantType.Jalapeno;
        else if (this is PotatoMineData)
            Type = PlantType.PotatoMine;
        else if (this is RepeaterData)
            Type = PlantType.Repeater;
        else if (this is SquashData)
            Type = PlantType.Squash;
        else if (this is TorchwoodData)
            Type = PlantType.Torchwood;
        else if (this is TwinSunFlowerData)
            Type = PlantType.TwinSunFlower;
        else if (this is WallNutData)
            Type = PlantType.WallNut;
    }
}
